<%@ page import="fleet_management.VehicleDatabase"%>
<script type="text/javascript">
$(document).ready(function() {
var vehicleType='${vehicleDescriptionInstance?.vehicleType}';
	if(vehicleType=="Vehicle"){
	<%--	alert(duty);--%>
		document.getElementById("vehicle").checked=true;
	}
	if(duty=="MorotBike"){
		document.getElementById("motorBike").checked=true;
	}
	
var duty='${vehicleDescriptionInstance?.duty}';
if(duty=="Free"){
<%--	alert(duty);--%>
	document.getElementById("dutyFree").checked=true;
}
if(duty=="Paid"){
	document.getElementById("dutyPaid").checked=true;
}
var hand='${vehicleDescriptionInstance?.hand}';
if(hand=="First"){
	document.getElementById("firstHand").checked=true;
}
if(hand=="Second"){
	document.getElementById("secondHand").checked=true;
}
if(hand=="Third"){
	document.getElementById("thirdHand").checked=true;
}
var fuelType='${vehicleDescriptionInstance?.fuelType}';
if(fuelType=="Petrol"){
	document.getElementById("petrol").checked=true;
}
if(fuelType=="Diesel"){
	document.getElementById("diesel").checked=true;
}
if(fuelType=="Electric"){
	document.getElementById("electric").checked=true;
}
if(fuelType=="Solar"){
	document.getElementById("solar").checked=true;
}
});

</script>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'vehicleType', 'error')} required">
	<label for="vehicleType"> <g:message
			code="vehicleDescription.vehicleType.label" default="Vehicle Type" /><span class="required-indicator">*</span>

	</label>
	<g:radio name="vehicleType" id="vehicle" value="Vehicle" />
	&nbsp;&nbsp;Vehicle&nbsp;&nbsp;
	<g:radio name="vehicleType" id="motorBike" value="Motor-Bike" />
	&nbsp;&nbsp;Motor-Bike
	<%--	<g:textField name="duty" value="${vehicleDescriptionInstance?.duty}"/>--%>
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'vehicleNumber', 'error')} required">
	<label for="vehicleNumber"> <g:message
			code="vehicleDescription.vehicleNumber.label"
			default="Vehicle Number" /> <span class="required-indicator">*</span>
	</label>
	<g:textField name="vehicleNumber" required=""
		value="${vehicleDescriptionInstance?.vehicleNumber}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'brandName', 'error')} required">
	<label for="brandName"> <g:message
			code="vehicleDescription.brandName.label" default="Brand Name" /> <span
		class="required-indicator">*</span>
	</label>
	<g:textField name="brandName" required=""
		value="${vehicleDescriptionInstance?.brandName}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'model', 'error')} required">
	<label for="model"> <g:message
			code="vehicleDescription.model.label" default="Model" /> <span
		class="required-indicator">*</span>
	</label>
	<g:textField name="model" required=""
		value="${vehicleDescriptionInstance?.model}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'yearMade', 'error')} required">
	<label for="yearMade"> <g:message
			code="vehicleDescription.yearMade.label" default="Year Made" /> <span
		class="required-indicator">*</span>
	</label>
	<g:datePicker name="yearMade" precision="day"
		value="${vehicleDescriptionInstance?.yearMade}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'totalSeats', 'error')} required">
	<label for="totalSeats"> <g:message
			code="vehicleDescription.totalSeats.label" default="Total Seats" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="totalSeats"
		value="${vehicleDescriptionInstance?.totalSeats}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'engineNumber', 'error')} required">
	<label for="engineNumber"> <g:message
			code="vehicleDescription.engineNumber.label" default="Engine Number" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="engineNumber" required=""
		value="${vehicleDescriptionInstance?.engineNumber}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'chassisNumber', 'error')} required">
	<label for="chassisNumber"> <g:message
			code="vehicleDescription.chassisNumber.label"
			default="Chassis Number" /> <span class="required-indicator">*</span>
	</label>
	<g:textField name="chassisNumber" required=""
		value="${vehicleDescriptionInstance?.chassisNumber}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'blueBookValidity', 'error')} required">
	<label for="blueBookValidity"> <g:message
			code="vehicleDescription.blueBookValidity.label"
			default="BlueBook Validity" /> <span class="required-indicator">*</span>
	</label>
	<g:datePicker name="blueBookValidity" precision="day"
		value="${vehicleDescriptionInstance?.blueBookValidity}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'pollutionCheck', 'error')} required">
	<label for="pollutionCheck"> <g:message
			code="vehicleDescription.pollutionCheck.label"
			default="Pollution Check" /> <span class="required-indicator">*</span>
	</label>
	<g:datePicker name="pollutionCheck" precision="day"
		value="${vehicleDescriptionInstance?.pollutionCheck}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'acquisitionDate', 'error')} required">
	<label for="acquisitionDate"> <g:message
			code="vehicleDescription.acquisitionDate.label"
			default="Acquisition Date" /> <span class="required-indicator">*</span>
	</label>
	<g:datePicker name="acquisitionDate" precision="day"
		value="${vehicleDescriptionInstance?.acquisitionDate}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'sourceOfFund', 'error')} required">
	<label for="sourceOfFund"> <g:message
			code="vehicleDescription.sourceOfFund.label" default="Source Of Fund" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="sourceOfFund" required=""
		value="${vehicleDescriptionInstance?.sourceOfFund}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'duty', 'error')} ">
	<label for="duty"> <g:message
			code="vehicleDescription.duty.label" default="Duty" />

	</label>
	<g:radio name="duty" id="dutyFree" value="Free" />
	&nbsp;&nbsp;Free&nbsp;&nbsp;
	<g:radio name="duty" id="dutyPaid" value="Paid" />
	&nbsp;&nbsp;Paid
	<%--	<g:textField name="duty" value="${vehicleDescriptionInstance?.duty}"/>--%>
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'hand', 'error')} ">
	<label for="hand"> <g:message
			code="vehicleDescription.hand.label" default="Hand" />

	</label>
	<g:radio name="hand" id="firstHand" value="First" />
	&nbsp;&nbsp;First&nbsp;&nbsp;
	<g:radio name="hand" id="secondHand" value="Second" />
	&nbsp;&nbsp;Second&nbsp;&nbsp;
	<g:radio name="hand" id="thirdHand" value="Third" />
	&nbsp;&nbsp;Third
	<%--	<g:textField name="hand" value="${vehicleDescriptionInstance?.hand}"/>--%>
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'fuelType', 'error')} ">
	<label for="fuelType"> <g:message
			code="vehicleDescription.fuelType.label" default="Fuel Type" />

	</label>
	<g:radio name="fuelType" id="petrol" value="Petrol" />
	&nbsp;&nbsp;Petrol&nbsp;&nbsp;
	<g:radio name="fuelType" id="diesel" value="Diesel" />
	&nbsp;&nbsp;Diesel&nbsp;&nbsp;
	<g:radio name="fuelType" id="electric" value="Electric" />
	&nbsp;&nbsp;Electric&nbsp;&nbsp;
	<g:radio name="fuelType" id="solar" value="Solar" />
	&nbsp;&nbsp;Solar
	<%--		<g:textField name="fuelType"--%>
	<%--			value="${vehicleDescriptionInstance?.fuelType}" />--%>
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'totalCost', 'error')} required">
	<label for="totalCost"> <g:message
			code="vehicleDescription.totalCost.label" default="Total Cost" /> <span
		class="required-indicator">*</span>
	</label>
	<g:field type="number" name="totalCost" required=""
		value="${fieldValue(bean: vehicleDescriptionInstance, field: 'totalCost')}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'insuranceValidity', 'error')} required">
	<label for="insuranceValidity"> <g:message
			code="vehicleDescription.insuranceValidity.label"
			default="Insurance Validity" /> <span class="required-indicator">*</span>
	</label>
	<g:datePicker name="insuranceValidity" precision="day"
		value="${vehicleDescriptionInstance?.insuranceValidity}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'insuredAmount', 'error')} required">
	<label for="insuredAmount"> <g:message
			code="vehicleDescription.insuredAmount.label"
			default="Insured Amount" /> <span class="required-indicator">*</span>
	</label>
	<g:textField name="insuredAmount"
		value="${vehicleDescriptionInstance?.insuredAmount}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: vehicleDescriptionInstance, field: 'premium', 'error')} required">
	<label for="premium"> <g:message
			code="vehicleDescription.premium.label" default="Premium" /> <span
		class="required-indicator">*</span>
	</label>
	<g:textField name="premium"
		value="${vehicleDescriptionInstance?.premium}" />
</div>
